<template>
  <div class="fan-table">
    <el-dialog
      title="粉他"
      :visible.sync="fanFormVisible"
       width="50%" :center="true">
      <el-form :model="fanForm" ref="fanForm" label-width="80px">
          <el-form-item prop="myCode" label="我的暗号" size="mini">
            <el-input v-model="fanForm.myCode" placeholder="我的暗号"></el-input>
          </el-form-item>
        <el-form-item prop="hisCode" label="他的暗号" size="mini">
          <el-input v-model="fanForm.hisCode" placeholder="他的暗号"></el-input>
        </el-form-item>
      </el-form>
      <span slot="footer">
        <el-button size="mini" type="warning" @click="fanFormVisible=false">取消</el-button>
        <el-button size="mini"  type="primary" @click="fanHe">确定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import singlePicUpload from '@/components/upload/singlePicUpload'
export default {
  name: 'wxCode-add',
  components: {
    singlePicUpload
  },
  data () {
    return {
      fanFormVisible: false,
      fanForm: {
        myCode: '',
        hisCode: ''
      }
    }
  },
  created: {
  },
  methods: {
    init () {
      this.fanFormVisible = true
      this.$nextTick(() => {
        this.$refs['fanForm'].resetFields()
      })
    },
    fanHe () {
      let that = this
      let params = {
        myCode: this.fanForm.myCode,
        hisCode: this.fanForm.hisCode
      }
      console.log(6666)
      console.log(params)
      this.$api.fanHe(params).then(res => {
        console.log(res)
        if (res.data.code === 200) {
          that.fanFormVisible = false
          that.$emit('refreshDataList')
        } else {
          console.log(res.data)
        }
      }).catch(error => {
        console.log(error)
      })
    }
  }

}
</script>

<style scoped>
  .wx-table{
    margin: auto;
    width: 80%;
  }
  .wx-table{
    width: 100px;
    height: 100px;
    border-radius: 5px;
    overflow: hidden;
  }
  body .el-table th.gutter{
    display: table-cell!important;
  }

</style>
